home *** CD-ROM | disk | FTP | other *** search
- /*
- File: AdminMessagePort.h
-
- Contains: xxx put contents here xxx
-
- Version: Technology: xxx put the technology version here xxx
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __ADMINMESSAGEPORT__
- #define __ADMINMESSAGEPORT__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- #if FOR_SYSTEM8_PREEMPTIVE
- /*
- //------------------------------------------------------------------------------------
-
- The I/O system reserves one bit of the Kernel message system's type mask to use
- for administration messages. Different services within the I/O system use this
- single message type. The routine and constants described in this file are used
- by clients of these administration services to distinguish between the different
- types.
-
- It is intended that clients of I/O administration services use a single Kernel
- message port (PortID) for all messages: administration and data. Clients can
- create multiple message objects (ObjectID) for the same port and pass a different
- object to each administration service and use another for data handling.
-
- The client should use separate tasks to receive administration messages and data
- messages. Use the message type parameter of ReceiveMessage as a bit-mask to specify
- the type of message to receive in each task. The code below shows an example of an
- administration task.
-
- AdministrationTask()
- {
- MessageControlBlock mcb;
- union {
- DevNMessage devn;
- PMMessage pm;
- Arbitration arb;
- } adminBuffer;
- UInt32 messageType;
-
- while (true)
- {
- ReceiveMessageSync(adminPort, kAMPMessageTypeMask, &mcb, &adminBuffer, ...)
- AMPGetMessageType(mcb->messageContents, &messageType);
-
- switch (messageType)
- {
- case kAMPDeviceNotificationMsg:
- {
- DevNMessage* devn = mcb.messageContents;
- switch (devn->subMessageType)
- {
- ...
- }
- }
- break;
- case kAMPPowerManagementMsg:
- {
- PMMessage* pm = mcb.messageContents;
- switch (pm->type)
- {
- ...
- }
- }
- break;
- case kAMPArbitrationServiceMsg:
- {
- Arbitration* arb = mcb.messageContents;
- switch (arb->type)
- {
- ...
- }
- }
- break;
- default:
- break;
- }
- }
- }
-
- //------------------------------------------------------------------------------------
- */
- /* Constants for use in ReceiveMessage.*/
-
- enum {
- kAMPMessageTypeMask = 0x08000000, /* highest bit not reserved by the kernel*/
- kNonKernelNonAMPMessageTypes = 0x07FFFFFF
- };
-
- /* Constants returned by AMPGetMessageType*/
-
- enum {
- kAMPDeviceNotificationMsg = 1,
- kAMPPowerManagementMsg = 2,
- kAMPArbitrationServiceMsg = 3
- };
-
- /*
- AMPGetMessageType:
-
- Given an I/O administration message this routine determines the type of
- message. If the type cannot be deteremined zero is returned and debugging
- builds throw an assertion.
- */
- extern void AMPGetMessageType(void *messageContents, UInt32 *messageType);
-
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __ADMINMESSAGEPORT__ */
-
-